<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<title>信息管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="/style/basic_layout.css" rel="stylesheet" type="text/css">
    <link href="/style/common_style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script type="text/javascript" src="/artDialog/jquery.artDialog.js?skin=blue"></script>
    <script type="text/javascript" src="/js/jquery/plugins/jquery.form.min.js"></script>
    <script type="text/javascript" src="/js/commonAll.js"></script>
    <script type="text/javascript" src="/js/input.js"></script>
    <script type="text/javascript">
	 	 //保存提示
	    $(function(){
	    	$("#editForm").ajaxForm(function(data){
	    		if(data.flag){
	    			myconfirm("保存成功","succeed",function(){
	    				window.location.href="/role/list";
	    			},false);
	    		}else{
	    			myconfirm("保存失败","error",true,false);
	    		}
	    	});
	    });
    </script>
</head>
<body>
<form name="editForm" action="/role/saveOrUpdate" method="post" id="editForm">
	<div id="container">
		<div id="nav_links">
			<span style="color: #1A5CC6;">角色${empty role ? '添加' : '编辑'}</span>
			<div id="page_close">
				<a>
					<img src="/images/common/page_close.png" width="20" height="20" style="vertical-align: text-top;"/>
				</a>
			</div>
		</div>
		<div class="ui_content">
			<table cellspacing="0" cellpadding="0" width="100%" align="left" border="0">
				<tr>
					<td>
						<input type="hidden" name="id" value="${role.id}">
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt" width="140">角色名称</td>
					<td class="ui_text_lt">
						<input name="name" class="ui_input_txt02" value="${role.name}"/>
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt" width="140">角色编码</td>
					<td class="ui_text_lt">
						<input type="text" name="sn" id="password" class="ui_input_txt02" value="${role.sn}"/>
					</td>
					<tr>
                    <td class="ui_text_rt" width="140">权限</td>
                    <td class="ui_text_lt">
                        <table>
                            <tr>
                                <td>
                                    <select id="select1" multiple="true" class="ui_multiselect01">
                                    	<c:forEach items="${permissions}" var="p">
                                    		<option value="${p.id}">${p.name}</option>
                                    	</c:forEach>
                                    </select>
                                </td>
                                <td align="center">
                                    <input type="button" id="select" value="-->" class="left2right"/><br/>
                                    <input type="button" id="selectAll" value="==>" class="left2right"/><br/>
                                    <input type="button" id="deselect" value="<--" class="left2right"/><br/>
                                    <input type="button" id="deselectAll" value="<==" class="left2right"/>
                                </td>
                                <td>
                                    <select id="select2" name="ids" multiple="true" class="ui_multiselect01">
	                                    <c:forEach items="${role.permissions}" var="rp">
	                                    		<option value="${rp.id}">${rp.name}</option>
	                                   	</c:forEach>	
	                                </select>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
					<tr>
                    <td class="ui_text_rt" width="140">系统菜单</td>
                    <td class="ui_text_lt">
                        <table>
                            <tr>
                                <td>
                                    <select id="mselect1" multiple="true" class="ui_multiselect01">
                                    	<c:forEach items="${systemMenus}" var="m">
                                    		<option value="${m.id}">${m.name}</option>
                                    	</c:forEach>
                                    </select>
                                </td>
                                <td align="center">
                                    <input type="button" id="mselect" value="-->" class="left2right"/><br/>
                                    <input type="button" id="mselectAll" value="==>" class="left2right"/><br/>
                                    <input type="button" id="mdeselect" value="<--" class="left2right"/><br/>
                                    <input type="button" id="mdeselectAll" value="<==" class="left2right"/>
                                </td>
                                <td>
                                    <select id="mselect2" name="munuIds" multiple="true" class="ui_multiselect01">
	                                    <c:forEach items="${role.systemMenus}" var="rM">
	                                    		<option value="${rM.id}">${rM.name}</option>
	                                   	</c:forEach>	
	                                </select>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
				</tr>
					<td>&nbsp;</td>
					<td class="ui_text_lt">
						&nbsp;<input type="submit" value="确定${empty role ? '添加' : '编辑'}" class="ui_input_btn01"/>
						&nbsp;<input id="cancelbutton" type="reset" value="重置" class="ui_input_btn01"/>
					</td>
				</tr>
			</table>
		</div>
	</div>
</form>
</body>
</html>